﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
namespace XYZshell.Game.CardGameEngine
{
	/// <summary>
	/// 卡片集合
	/// </summary>
	[Serializable]
	[XmlRoot("Cards")]
	public class CardCollection :NameFindableCollection<Card>
	{
		public CardCollection()
		{
		}
		public CardCollection( IList<Card> cards )
			: base( cards )
		{

			
		}

		/// <summary>
		/// 把当前集合中卡片转移到目标集合
		/// </summary>
		/// <param name="target"></param>
		/// <param name="card"></param>
		public void Move( CardCollection target ,Card card)
		{

			Card it= Items.First<Card>( ( c ) =>
			{
				return  c == card;
				
			} );
			if (it != null)
			{
				target.Add( it );
				Items.Remove( it );
			}
		}
	}
}
